package com.zoran.study.spring.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


/**
 * AppLog
 *
 * @author zouxm
 * @date 2018/4/11
 */
@Aspect
@Order(value = 0)  //当多个切面应用在一个连接点时候,order越小,优先级越高,优先执行
@Component
public class InvokeLog {

    @Before(value = "execution( * com.zoran.study.spring.service..*(..)) && @annotation(Mark)")
    public void before(JoinPoint jp) {
        MethodSignature signature = (MethodSignature) jp.getSignature();
        System.out.println(signature.getMethod().isAnnotationPresent(Mark.class));
        System.out.println("before invoke log params");
    }

}
